package com.prs.crm.dao.sale.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.dao.sale.SalesShippingDao;
import com.prs.crm.domain.sale.GatheringWay;
import com.prs.crm.domain.sale.InvoiceType;
import com.prs.crm.domain.sale.SalesContract;
import com.prs.crm.domain.sale.SalesShipping;
import com.prs.crm.domain.sale.SalesShippingDetail;
import com.prs.crm.domain.sale.ShippingWay;

public class SalesShippingDaoImpl extends BaseDaoImpl<SalesShipping> implements
		SalesShippingDao {

	@Override
	public List<SalesShippingDetail> getAllDetails() {
		// TODO Auto-generated method stub
		return this.getHibernateTemplate().loadAll(SalesShippingDetail.class);
	}

	@Override
	public List<SalesShipping> getSalesShippingBySalesContract(
			SalesContract salesContract) {
		Criteria criteria = this.getSession().createCriteria(
				SalesShipping.class);
		criteria.add(Restrictions.eq("salesContract", salesContract));
		return (List<SalesShipping>) criteria.list();
	}

	@Override
	public List<SalesShippingDetail> getAllDetailsBySalesShipping(
			SalesShipping salesShipping) {
		Criteria criteria = this.getSession().createCriteria(
				SalesShippingDetail.class);
		criteria.add(Restrictions.eq("salesShipping", salesShipping));
		return (List<SalesShippingDetail>)criteria.list();
	}

}
